

/**
 * <p>Title: UserDao</p>
 * <p>Description: UserDao</p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author ChenWei & Huang Zhongwei
 * @version 1.0
 * <pre>Histroy:
 *       2016-9-18  ChenWei & Huang Zhongwei  Create
 *</pre>
*/
package cn.jhg.account.persist;
import java.util.List;
import java.util.Map;

import cn.jhg.account.entity.User;

public interface UserDao {
	/**
	 * 按 ID 获取用户
	 * 
	 * @param uid	User ID
	 * @return User Object
	 */
	public User getUserById(int uid);

	/**
	 * 按帐户名获取用户
	 * 
	 * @param account	account name
	 * @return User Object
	 */
	public User getUserByAccount(String account);

	/**
	 * 按用户名字查找用户（模糊查询），eg: 输入“张三”返回所有名字中带有“张三”的用户
	 * 
	 * @param condition	用户名
	 * @return A set of User Object
	 */
	public List<Integer> findUserByName(String condition);

	/**
	 * 增加用户
	 * 
	 * @param user	User Object
	 * @return Error Code
	 */
	public int addUser(User user);

	/**
	 * 更新用户
	 * 
	 * @param user	User Object
	 * @return	Error Code
	 */
	public int updateUser(User user);


	/**
	 * 失效用户
	 * 
	 * @param uid	User Id
	 * @return	Error Code
	 */
	public int invalidateUser(User user);

	/**
	 * 用户登录
	 * @param map		Account And Password (Encrypted by SHA-512)
	 * @return	Error Code
	 */
	public User logIn(Map<String,String> map);

	/**
	 * 获取所属用户组
	 * @param uid	User Id
	 * @return	A set of User Group Id which the user belongs to.
	 */
	public List<Integer> getUserGroup(int uid);
	
	/**
	 * 获取所属用户密码
	 * @param uid	User Id
	 * @return	String Password
	 */
	public String getPasswordById(int uid);
	
	/**
	 * 查找用户
	 * @param map
	 * @return A set of User Id.
	 */
	public List<Integer> findUser(Map<String,String> map);
	
	/**
	 * 查找用户
	 * @param map
	 * @return A set of User Id.
	 */
	public List<User> findUsers(Map<String,String> map);
	/**
	 * 查询不在固定用户组的用户
	 * 
	 */
	public List<User> findUserExist(int ugid);
	
}
